package com.cdc.widget;

import android.R;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.TextView;

public class CustomViewGroup1 extends ViewGroup {
	private Context context;
	
	private static final String CLASS_NAME = "CustomViewGroup1";
	@Override
	protected void onLayout(boolean changed, int l, int t, int r, int b) {
		TextView textview1 = new TextView(this.context);
		textview1.setText("text1");
		textview1.setTextSize(80);
		textview1.setTextColor(context.getResources().getColor(R.color.holo_blue_bright));
		addView(textview1, 0);
		int textview1Left = (r-l)/2-t;
		int textview1Right = (r-1)/2+400;
		int textview1Top = (b-t)/2-200;
		int textviewBottom = (b-t)/2+200;
		Log.v(CLASS_NAME, "onLayout(changed = " + changed + ", l = " + l + ", t = " + t + ", r = " + r + ", b = " + b + ")");
		Log.v(CLASS_NAME, "textview1Left = " + textview1Left + ", textview1Right = " + textview1Right + ", textview1Top = " + textview1Top + ", textviewBottom = " + textviewBottom);
		textview1.layout(textview1Left, textview1Top, textview1Right, textviewBottom);
	}

	public CustomViewGroup1(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.context = context;
	}

}
